import Vue from 'vue'

Vue.filter('substr', function (val, num) {
  if (!val) {
    return ''
  }
  let stringLen = val.length
  if (num >= stringLen) {
    return val
  } else {
    return val.substr(0, num) + '...'
  }
})
